package com.company.test23;

/**
 * Created by Administrator on 2016.9.29.
 */
public class Test2301 {
    public static void main(String[] args) {
        System.out.println(sum("Welcome"));
    }

    public static String sum(String string){
        if(string.length()==0){
            return "";
        }
        String max=string.charAt(0)+"";
        String str=string.charAt(0)+"";
        char ch=string.charAt(0);

        for(int i=1;i<string.length();i++){
            if(string.charAt(i)>=ch){
                ch=string.charAt(i);
                str=str+ch;
            }else{
                ch=string.charAt(i);
                if(str.length()>max.length()){
                    max=str;
                    str=""+ch;
                }
            }
        }
        return max;
    }
}
